from selenium.webdriver.common.by import By

from base.mp.base import BasePage, BaseHandle


class HomePage(BasePage):
    def __init__(self):
        super().__init__()
        self.username=By.XPATH,'//*[@id="app"]/div/div[2]/div/div[2]/div[2]/div/span'
        self.content_manage=By.XPATH, '//*[@id="app"]/div/div[1]/ul/div[2]/li/div'
        self.publish_btn=By.XPATH,'//*[@id="app"]/div/div[1]/ul/div[2]/li/ul/li[1]'
    def find_username(self):
        return self.get_element(self.username)
    def find_content_manage(self):
        return self.get_element(self.content_manage)
    def find_publish_btn(self):
        return self.get_element(self.publish_btn)
class HomeHandle(BaseHandle):
    def __init__(self):
        self.home_page=HomePage()
    def get_username(self):
        return self.home_page.find_username().text
    def click_content_manage(self):
        self.home_page.find_content_manage().click()
    def click_publish_btn(self):
        self.home_page.find_publish_btn().click()
class HomeProxy:
    def __init__(self):
        self.home_handle=HomeHandle()
    def get_username_msg(self):
        return self.home_handle.get_username()
    def go_publish_page(self):
        self.home_handle.click_content_manage()
        self.home_handle.click_publish_btn()